/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package myBeanPavkage;

import javax.annotation.PostConstruct;
import javax.ejb.LocalBean;
import javax.ejb.Stateful;

/**
 *
 * @author ajou
 */
@Stateful
@LocalBean
public class AccountBean {

    private long id;
    private double balance;
    
    @PostConstruct
    private void init(){
        
    }
    public AccountBean(){
        balance=100;
    }
    public AccountBean(double sum){
        balance=sum;
    }
    public String deposit (double sum){
        balance=+sum;
        if(sum>0){
        return "Thank You!";
        }
        else{
            return "You must deposit a positive sum!";
        }
    }
    public String withdraw(double sum){
        if(sum>0){
        balance=-sum;
        return "You're Welcome!";
        }
        else {
            return "Negative sums are not allowed";
        }
    }
    public double checkBalance(){
        return balance;
    }
    // Add business logic below. (Right-click in editor and choose
    // "Insert Code > Add Business Method")
}
